$(function(){
    
    $('form').submit(function(){
        return false;
    });
    
    $('#connectButton').click(function(){
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: 'http://localhost/html5ftp/ftp/login',
            data: $('form').serialize(),
            success: function(response){
                if (response.res == true){
                    $('#main').load('http://localhost/html5ftp/ftp/listFiles');
                } else {
                    alert(response.msg);
                }
            },
            error: function(r) {
                alert(r);
            }
        });
    });

});
